function F = cal_indicator(param, q_opt_index)

    Q = param.Q;
    Nf = param.Nf;

    % transform into a linear index 
    linear_index = sub2ind([Nf,Q], [1:Nf]', q_opt_index);
    
    % new sparse decision matrix
    q_indicator = sparse(Nf, Q);
    q_indicator(linear_index) = 1; 
    
    % return
    F = q_indicator;

end